package btd.game.dlgs;

import btd.game.ConstData;
import btd.game.activities.PBoardAct;
import btd.game.activities.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class QiuheResultDlg extends Dialog {
	//private PBoardAct owner = null;
	private String kind = "";
	//private boolean isTouxiang = false;
	//private final Handler mHandler = new Handler();
	public QiuheResultDlg(Context context, String kind) {
		super(context);
	//	this.owner = (PBoardAct) context;
		this.setContentView(R.layout.qiuheresultdlg);
		this.kind = kind;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setTitle(ConstData.L_USERNAME + kind);
	//	Button bLook = (Button) findViewById(R.id.ButtonLook);
	//	bLook.setOnClickListener(lookListener);
	//	Button bOK = (Button) findViewById(R.id.ButtonReOpen);
	//	bOK.setOnClickListener(okListener);
	//	Button bCancel = (Button) findViewById(R.id.ButtonQiuheInfoCancel);
	//	bCancel.setOnClickListener(cancelListener);
		TextView tvLName = (TextView) findViewById(R.id.TextViewQiuheWName);
		TextView tvLR = (TextView) findViewById(R.id.TextViewQiuheWR);
		TextView tvDName = (TextView) findViewById(R.id.TextViewQiuheBName);
		TextView tvDR = (TextView) findViewById(R.id.TextViewQiuheBR);
		tvLName.setText(ConstData.L_USERNAME);
		tvLR.setText(ConstData.L_USER_R);
		tvDName.setText(ConstData.D_USERNAME);
		tvDR.setText(ConstData.D_USER_R);
		
		new Thread(closeRun).start();
	}
	
	private Runnable closeRun = new Runnable() {
		@Override
		public void run() {
			try {
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				//e.printStackTrace();
			}
			//owner.qiutouResultLook();
			//mHandler.post(mUpdateClose);
			QiuheResultDlg.this.cancel();
		}
	};

	//protected final Runnable mUpdateClose = new Runnable() {
	//	public void run() {
	//		owner.qiutouResultLook();
	//	}
	//};
	
	//private View.OnClickListener lookListener = new View.OnClickListener() {
	//	public void onClick(View v) {
			//if(owner.view.status) {
			//	owner.lStartSubTime();
			//} else {
			//	owner.dStartSubTime();
			//}
	//		owner.qiutouResultLook();
	//		QiuheResultDlg.this.cancel();
	//	}
	//};
	
	//private View.OnClickListener okListener = new View.OnClickListener() {
	//	public void onClick(View v) {
			//if(owner.view.status) {
			//	owner.lStartSubTime();
			//} else {
			//	owner.dStartSubTime();
			//}
	//		owner.qiutouResultOK();
	//		QiuheResultDlg.this.cancel();
	//	}
	//};
	
	//private View.OnClickListener cancelListener = new View.OnClickListener() {
	//	public void onClick(View v) {
			//if(owner.view.status) {
			//	owner.lStartSubTime();
			//} else {
			//	owner.dStartSubTime();
			//}
	//		owner.qiutouResultCancel();
	//		QiuheResultDlg.this.cancel();
	//	}
	//};
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		super.onKeyDown(keyCode, event);
		//switch(keyCode) {
		//case KeyEvent.KEYCODE_BACK:
			//owner.qiutouResultCancel();
			//QiuheResultDlg.this.cancel();
			return true;
		//}
		//return false;
	}
}
